﻿using System;

namespace Gonte.Networking
{
    /// <summary>
    /// The interface to handle the network connections
    /// </summary>
    public interface INetworkConnectionHandler
    {
        /// <summary>
        /// Creates a client data
        /// </summary>
        /// <returns></returns>
        ClientData CreateClientData();

        /// <summary>
        /// Handles a request
        /// </summary>
        /// <param name="readerWriter"></param>
        /// <param name="request"></param>
        /// <param name="hasMoreData"></param>
        void HandleRequest(NetworkStreamReaderWriter readerWriter, string request, bool hasMoreData);

        /// <summary>
        /// Handles a client disconnection
        /// </summary>
        /// <param name="readerWriter"></param>
        void HandleClientDisconnected(NetworkStreamReaderWriter readerWriter);

        /// <summary>
        /// Handles an exception
        /// </summary>
        /// <param name="readerWriter"></param>
        /// <param name="exception"></param>
        /// <param name="isReading"></param>
        void HandleException(NetworkStreamReaderWriter readerWriter, Exception exception, bool isReading);
    }
}
